class Student(object):
    def __init__(self):
        self._score = 0
    # @property装饰器就是负责把一个方法变成属性调用
    @property
    def score(self):
        return self._score
    # @score.setter，负责把一个setter方法变成属性赋值
    @score.setter
    def score(self, value):
        if not isinstance(value, int):
            raise ValueError('score must be an integer!')
        if value < 0 or value > 100:
            raise ValueError('score must between 0 ~ 100!')
        self._score = value
    # 只定义getter就是只读属性
    @property
    def age(self):
        return 18
        
s1 = Student()
print(s1.score)
s1.score = 10
print(s1.score)